<?php
/*
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-02-04 16:53:56
 * @LastEditTime: 2023-10-05 14:55:13
 * @LastEditors: 孙开源 && sunkaiyuan@namenode.cn
 * @Description: 
 */

namespace App\Http\Services\Storage;


use App\Http\Services\Service;
use App\Repositories\OpenCardGlueRepository;

/**
 * @property OpenCardGlueRepository $repository  
 */
class GlueService extends Service
    {
    public function boot(OpenCardGlueRepository $repository)
        {
        $this->repository = $repository;
        }

    public function list()
        {
        $data = $this->repository->condition(request())->getGrid();
        return $data;
        }
    public function details()
        {
        return $this->repository->condition()->first()->mpc_detail()->with(['location', 'material'])->get();
        }

    protected function audit()
        {
        return $this->repository->whereIn("id", $this->getRequestIds())->get()->filter(function ($v)
            {
            $this->repository->audit($v);
            });
        }

    protected function noaudit()
        {
        return $this->repository->whereIn("id", $this->getRequestIds())->get()->filter(function ($v)
            {
            $this->repository->noaudit($v);
            });
        }
    }